<%@page import="com.zhuoshi.bean.ContractSubBean"%>
<%@page import="com.zhuoshi.dao.ContractSubDao"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
request.setCharacterEncoding("UTF-8");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

ContractSubDao dao = new ContractSubDao();
List<ContractSubBean> list = dao.getAllList();
pageContext.setAttribute("list", list);


%>

<!DOCTYPE html>

<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
    <link rel="stylesheet" type="text/css" href="template/H-ui.min.css">
    <link rel="stylesheet" type="text/css" href="template/H-ui.admin.css">
    <link rel="stylesheet" type="text/css" href="template/iconfont.css">
    <link rel="stylesheet" type="text/css" href="template/icheck.css">
    <link rel="stylesheet" type="text/css" href="template/skin.css" id="skin">
    <link rel="stylesheet" type="text/css" href="template/style.css">
    <link rel="stylesheet" type="text/css" href="template/showLoading.css">
    <title>报价制作</title>

    <style type="text/css">
    div#activity_pane {
            float: center;
            width: 150px;
            margin-top: 200px;
            height: 50px;
            border: 1px solid #CCCCCC;
            background-color: #EEEEEE;
            margin-left: 500px;
            text-align: center;
            display: none;
        }
        
        input[type=checkbox] {
            width: 20px;
            height: 20px;
        }
        
        .checkboxFive {
            width: 25px;
            margin: 20px 100px;
            position: relative;
        }
        
        .checkboxFive label {
            cursor: pointer;
            position: absolute;
            width: 25px;
            height: 25px;
            top: 0;
            left: 0;
            background: #eee;
            border: 1px solid #ddd;
        }
        
        .checkboxFive label:after {
            opacity: 0.2;
            content: '';
            position: absolute;
            width: 9px;
            height: 5px;
            background: transparent;
            top: 6px;
            left: 7px;
            border: 3px solid #333;
            border-top: none;
            border-right: none;
            -webkit-transform: rotate(-45deg);
            -moz-transform: rotate(-45deg);
            -o-transform: rotate(-45deg);
            -ms-transform: rotate(-45deg);
            transform: rotate(-45deg);
        }
        
        .checkboxFive label:hover::after {
            opacity: 0.5;
        }
        /**
 * Create the checkbox state for the tick
 */
        
        .checkboxFive input[type=checkbox]:checked+label:after {
            opacity: 1;
        }
    }
    </style>

    <script type="text/javascript">
        function sum() {

            var json = "";
            var checks = document.getElementsByName("mcheck");
            var names = document.getElementsByName("name");
            var models = document.getElementsByName("model");
            var remarks = document.getElementsByName("remark");
            var nums = document.getElementsByName("num");
            var beizhus = document.getElementsByName("beizhu");
            var item = "";
            for (var i = 0; i < checks.length; i++) {
                if (checks[i].checked) {
                    var name = names[i].innerHTML;
                    var model = models[i].innerHTML;
                    var remark = remarks[i].innerHTML;
                    var num = nums[i].value;
                    if (num == '') {
                        return;
                    }
                    var beizhu = beizhus[i].value;
                    var index = checks[i].value;
                    var price = document.getElementById("price" + index).value;

                    item = "{\"name\":\"" + name + "\",\"model\":\"" + model + "\",\"remark\":\"" + remark + "\",\"num\":\"" + num + "\",\"beizhu\":\"" + beizhu + "\",\"price\":\"" + price + "\"}";

                    json = json + item + "&";


                }
            }
            $.ajax({

                url: "createBaoJia",
                type: "post",
                data: {
                    data: json
                },
                dataType: "text",
                beforeSend: function() {
                    console.log("aaaaaaaaaa");
                    jQuery("#page-content").showLoading({
                        'addClass': 'loading-indicator-bars'

                    });

                },
                success: function(data) {

                    window.open("excel/" + data, null, null, true);
                    jQuery("#page-content").hideLoading();

                },
                error: function() {

                }

            });

        }
    </script>
    <link rel="stylesheet" href="template/layer.css" id="layui_layer_skinlayercss">
    <link href="template/WdatePicker.css" rel="stylesheet" type="text/css">
</head>



<body>



    <form name="form1" action="http://localhost:8080/EMIS/delcontractinfo" method="post" id="form1">
        <input type="hidden" name="id" id="id">
    </form>

    <nav class="breadcrumb"><i class="Hui-iconfont"></i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 报价单制作 </nav>
    <div class="page-container" id="page-content">
        <div class="text-r">

            <button type="submit" class="btn btn-success radius" id="" name="" onclick="sum()">导出成excel</button>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-50">


            <div class="mt-50">

                <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper no-footer">
                    <div class="dataTables_length" id="DataTables_Table_0_length"><label>显示 <select name="DataTables_Table_0_length" aria-controls="DataTables_Table_0" class="select"><option value="10">10</option><option value="25">25</option><option value="50">50</option><option value="100">100</option></select> 条</label></div>
                    <div
                        id="DataTables_Table_0_filter" class="dataTables_filter"><label>从当前数据中检索:<input type="search" class="input-text " aria-controls="DataTables_Table_0"></label></div>
                <table class="table table-border table-bordered table-hover table-bg table-sort dataTable no-footer" id="DataTables_Table_0"
                    role="grid" aria-describedby="DataTables_Table_0_info">
                    <thead>
                        <tr class="text-c" role="row">
                            <th width="40" class="sorting_disabled" rowspan="1" colspan="1" aria-label="" style="width: 60px;"><input type="checkbox" name="" value=""></th>
                            <th width="40" class="sorting_desc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="descending" aria-label="备件名称: 升序排列" style="width: 60px;">备件名称</th>
                            <th width="100" class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="规格型号: 升序排列" style="width: 141px;">规格型号</th>
                            <th width="80" class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="单位: 升序排列" style="width: 114px;">单位</th>
                            <th width="80" class="sorting_disabled" rowspan="1" colspan="1" aria-label="销售单价" style="width: 169px;">销售单价</th>
                            <th width="80" class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="数量: 升序排列" style="width: 114px;">数量</th>
                            <th width="80" class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="备注: 升序排列" style="width: 279px;">备注</th>
                        </tr>
                    </thead>
                    <tbody>
































						<c:forEach items="${list }" var="bean">
						
                        <tr class="text-c odd" role="row">
                            <td> <input type="checkbox" name="mcheck" value="${bean.id }"> </td>
                            <td name="name" class="sorting_1">${bean.sqarename }</td>
                            <td name="model">${bean.modeltype }</td>
                            <td name="remark">${bean.unit }</td>
                            <td name="price">

                                <select id="price${bean.id }" class="input-text" style="width: 120px">
			
						
				        <option value="${bean.price }">${bean.price }</option>
						
						</select>

                            </td>

                            <td><input name="num" required="required" value="0" class="input-text" style="width:80px ;" onkeyup="this.value=this.value.replace(/\D/g,&#39;&#39;)" onafterpaste="this.value=this.value.replace(/\D/g,&#39;&#39;)" type="text" placeholder="请输入数量"></td>

                            <td><input name="beizhu" class="input-text" style="width:200px" type="text" placeholder="请输入备注"> </td>
                        </tr>
                        </c:forEach>
                        
                        
                        
                       
                        
                        
                        
                    </tbody>
                </table>
                <div class="dataTables_info" id="DataTables_Table_0_info" role="status" aria-live="polite">显示 1 到 6 ，共 6 条</div>
                <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate"><a class="paginate_button previous disabled" aria-controls="DataTables_Table_0" data-dt-idx="0" tabindex="0" id="DataTables_Table_0_previous">上一页</a><span><a class="paginate_button current" aria-controls="DataTables_Table_0" data-dt-idx="1" tabindex="0">1</a></span>
                    <a
                        class="paginate_button next disabled" aria-controls="DataTables_Table_0" data-dt-idx="2" tabindex="0" id="DataTables_Table_0_next">下一页</a>
                </div>
            </div>
        </div>
    </div>
    <footer class="footer mt-20">
        <div class="container">
            Copyright © 本后台系统由KEG提供技术支持
        </div>
    </footer>
    <script type="text/javascript" src="template/jquery.min.js"></script>
    <script type="text/javascript" src="template/jquery.js"></script>
    <script type="text/javascript" src="template/layer.js"></script>
    <script type="text/javascript" src="template/laypage.js"></script>
    <script type="text/javascript" src="template/WdatePicker.js"></script>
    <script type="text/javascript" src="template/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="template/H-ui.js"></script>
    <script type="text/javascript" src="template/H-ui.admin.js"></script>
    <script type="text/javascript" src="template/jquery.showLoading.js"></script>
    <script type="text/javascript">
        $('.table-sort').dataTable({
            "aaSorting": [
                [1, "desc"]
            ], //默认第几个排序
            "bStateSave": true, //状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {
                    "orderable": false,
                    "aTargets": [0, 4]
                } // 制定列不参与排序
            ]
        });
        /*系统-栏目-添加*/
        function system_category_add(title, url, w, h) {
            layer_show(title, url, w, h);
        }
        /*系统-栏目-编辑*/
        function system_category_edit(title, url, id, w, h) {
            layer_show(title, url, w, h);
        }
        /*系统-栏目-删除*/
        function system_hetong_del(obj, id) {
            layer.confirm('确认要删除吗？', function(index) {
                $(obj).parents("tr").remove();
                document.getElementById("id").value = id;
                document.form1.submit();
                layer.msg('已删除!', {
                    icon: 1,
                    time: 1000
                });
            });
        }
    </script>

    </div>
    <a href="javascript:void(0)" class="Hui-iconfont toTop" title="返回顶部" alt="返回顶部" style="display:none"></a>
</body>

</html>